<%@ page import="java.util.ArrayList" %>
<%@ page import="com.docman.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.docman.domainmodel.*;" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>DocMan Dosya Yükleme</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
    div.center_content {text-align: center;}
    p {text-align: center; color: #5481E3; font-weight: bold}  
</style>

<script src="js/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(function()
{
	jQuery("#title").validate(
            {
                expression: "if (VAL) return true; else return false;",
                message: " <span style=\"color:red\">Baslık giriniz.</span>"
            });
	
	jQuery("#uploadFile").validate(
            {
            	 expression: "if (VAL) return true; else return false;",
                 message: " <span style=\"color:red\">Bir dosya seçiniz.</span>"
            });
});
</script>
</head>
<body>

<div id="main_container">
	<div id="header">
			<div class="logo"><a href="index.jsp"><img src="img/top.png" border="0" alt="" title="" /></a></div>       
	</div>
        <div class="menu">
            <ul>                                                                         
                <li><a href="index.jsp">Anasayfa</a></li>
                <li><a href="profileServletpath">Profil</a></li>
                <li class="selected"><a href="#">Dosya Yükleme</a></li>
                <li><a href="getTagServletpath?sId=1">Ayrıntılı arama</a></li>
                <li><a href="contract.jsp">İletişim</a></li>
                <% if(session.getAttribute("currentSessionUser")!= null){ 
                 UserBean user = (UserBean)session.getAttribute("currentSessionUser");%>
                <li><a href="logout.jsp">Çıkış <span style="color: red;">(<span style="font-weight: bold;
                     text-decoration: underline"><%= user.getUserName() %></span>)</span></a></li>
                <% } else { %>
                <li><a href="getUniandDeptServletpath">Kaydol</a></li>
                <% } %>
            </ul>
        </div>
        
    <div class="center_content">
    	
    	<%ArrayList<TagBean> tags = (ArrayList<TagBean>)(request.getAttribute("tagList")); %>
    	
    	<% if(session.getAttribute("currentSessionUser")!= null){ 
        UserBean user = (UserBean)(session.getAttribute("currentSessionUser")); %>
        
        	<form action="uploadServletpath" method="post"  enctype="multipart/form-data">
            	<p>Dosya Başlığı:</p>
            	<input type="text" name="title" size="30" id="title" />
            	<p>Dosya Etiketi:</p>
            	<select name="tag">
                	<% for(int i = 0; i < tags.size(); i++){ %>
                	<option value="<%=tags.get(i).getTagName() %>"><%=tags.get(i).getTagName() %></option>
                	<%} %>	
            	</select>
            	<p>Tanım:</p>
            	<textarea name="comment" rows="5" cols="60"></textarea>
            	<br /><br />
            	<p>Yüklenecek Dosyayı Seçiniz:</p> 
            	<input type="file" name="uploadFile" id="uploadFile" /> 
            	<br /><br /> 
            	<input type="submit" class="button" value="Yükle" />
        	</form>
        
        <% }else { %>
		
			<p style="font-size: 1.5em; text-align: center;color:red">Lütfen <a href="index.jsp">Anasayfa</a>'dan giriş yapınız.  </p>	
			<p style="font-size: 1.5em; text-align: center;color:red">Veya menüden Kaydol butonuna tıklayıp sitemize üye olabilirsiniz. </p>
		
		<% } %>   
    </div>
         
</div>

</body>
</html>